package com.itheima.demo6;

import java.util.concurrent.ArrayBlockingQueue;

public class Cook2 extends Thread {
    ArrayBlockingQueue<String> queue;

    public Cook2(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {

        while (true){
            //将食物放入队列
            try {
                queue.put("吃面");
                System.out.println("厨师做了一碗面");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
